import request from '@/utils/request'
// 获取文章列表
export const articleListAPI = ({ channel_id, timestamp }) => {
  return request({
    url: '/v1_0/articles',
    params: {
      channel_id: channel_id,
      timestamp: timestamp || new Date().getTime() + ''
    }
  })
}
// 文章-不感兴趣 /v1_0/article/dislikes
export const articleDislikesAPI = ({ artId }) => {
  return request({
    url: '/v1_0/article/dislikes',
    method: 'POST',
    data: {
      target: artId
    }
  })
}

// 文章-举报 /v1_0/article/reports
export const articleReportsAPI = ({ artId, type }) => {
  return request({
    url: '/v1_0/article/reports',
    method: 'POST',
    data: {
      target: artId,
      // type: type + '', // 后台规定这里必须串字符串 得到的value是number
      type: type.toString(),
      remark: type === 0 ? '其他问题的说明' : null
    }
  })
}
// 文章_指定文章详情
export const articleDetailsAPI = ({ id }) => {
  return request({
    url: `/v1_0/articles/${id}`
  })
}
// 文章-关注作者 /v1_0/user/followings
export const followingAuthorAPI = ({ target }) => {
  return request({
    url: '/v1_0/user/followings',
    method: 'POST',
    data: {
      target: target
    }
  })
}
// 文章-取消关注作者
export const unFollowingAuthorAPI = ({ uid }) => {
  return request({
    url: `/v1_0/user/followings/${uid}`,
    method: 'DELETE'
  })
}
// 文章 - 喜欢/v1_0/article/likings
export const articleLikingsAPI = ({ target }) => {
  return request({
    url: '/v1_0/article/likings',
    method: 'POST',
    data: {
      target
    }
  })
}
// 文章 - 取消喜欢
export const articleDisLikingsAPI = ({ aid }) => {
  return request({
    url: `/v1_0/article/likings/${aid}`,
    method: 'DELETE'

  })
}
